package models;

import java.util.Date;

import siena.Id;
import siena.Model;
import siena.Query;
import siena.core.lifecycle.PreSave;

/**
 * @author oleksandr.bezhan
 * 
 *         Apr 14, 2012
 */
public class RecipeComment extends Model {
    public static Query<RecipeComment> all() {
        return Model.all(RecipeComment.class);
    }

    public String comment;

    public Date dateCreated;

    @Id
    public Long id;

    public String name;

    public Recipe recipe;

    public RecipeComment(String comment, String name) {
        this.comment = comment;
        dateCreated = new Date();
        this.name = name;
    }

    @SuppressWarnings("unused")
    @PreSave
    private void preSave() {
        dateCreated = new Date();
    }

    @Override
    public String toString() {
        return "RecipeComment [comment=" + comment + ", dateCreated=" + dateCreated + ", id=" + id + ", name=" + name
                        + ", recipe=" + recipe + "]";
    }
}